<%@ page language="java" 
	contentType="text/html; 
	charset=UTF-8"
	pageEncoding="UTF-8"
	import="connectMysql.TestConnect"
	%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form>
	  <label for="class-name">Class Name:</label><br>
	  <input type="text" id="class-name" name="class-name"><br>
	  <label for="invitation-code">Invitation Code:</label><br>
	  <input type="text" id="invitation-code" name="invitation-code" value=""><br>
	  <input type="button" value="Create Class" onclick="generateCode()">
	</form>

	<script>
	  function generateCode() {//生成随机邀请码result
	    let result = '';
	    let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
	    let charactersLength = characters.length;
	    for (let i = 0; i < 8; i++) {
	      result += characters.charAt(Math.floor(Math.random() * charactersLength));
	    }
	    document.getElementById('invitation-code').value = result;
	  }
	</script>
</body>
</html>